--[[	$Id: caelMinimap.lua 2555 2012-09-17 06:25:18Z sdkyron@gmail.com $	]]

local caelMinimap = CreateFrame("Frame", nil, Minimap)

for _, object in pairs({
		GameTimeFrame,
		MinimapBorder,
		MinimapZoomIn,
		MinimapZoomOut,
		MinimapNorthTag,
		MinimapBorderTop,
		MinimapToggleButton,
		MiniMapWorldMapButton,
		MinimapZoneTextButton,
		MiniMapBattlefieldBorder,
		MiniMapTrackingBackground,
		MiniMapTrackingIconOverlay,
		MiniMapTrackingButtonBorder,
}) do
	if object:GetObjectType() == "Texture" then
		object:SetTexture(nil)
	else
		object:Hide()
	end
end

Minimap:RegisterEvent("PLAYER_ENTERING_WORLD")
Minimap:SetScript("OnEvent", function(self, event, ...)
	self:EnableMouse(true)
	self:EnableMouseWheel(true)
	self:SetScript("OnMouseWheel", function(frame, direction)
		if direction > 0 then
			Minimap_ZoomIn()
		else
			Minimap_ZoomOut()
		end
	end)

	self:ClearAllPoints()
	self:SetParent(caelPanel3)
	self:SetFrameLevel(caelPanel3:GetFrameLevel() - 1)
	self:SetPoint("CENTER")
	self:SetSize(caelPanel3:GetWidth() - caelLib.scale(5), caelPanel3:GetHeight() - caelLib.scale(5))

	self:SetMaskTexture(caelMedia.files.bgFile)
	self:SetBlipTexture([=[Interface\Addons\caelMedia\miscellaneous\charmed.tga]=])

	MinimapCluster:EnableMouse(false)

	QueueStatusMinimapButton:SetParent(self)
	QueueStatusMinimapButton:ClearAllPoints()
	QueueStatusMinimapButton:SetPoint("TOPRIGHT")

	MiniMapTracking:SetParent(self)
	MiniMapTracking:ClearAllPoints()
	MiniMapTracking:SetPoint("TOPLEFT")
	MiniMapTracking:SetAlpha(0)

	MiniMapTrackingButton:SetHighlightTexture(nil)
	MiniMapTrackingButton:SetScript("OnEnter", function() MiniMapTracking:SetAlpha(1) end)
	MiniMapTrackingButton:SetScript("OnLeave", function() MiniMapTracking:SetAlpha(0) end)

	MiniMapInstanceDifficulty:ClearAllPoints()
	MiniMapInstanceDifficulty:SetParent(Minimap)
	MiniMapInstanceDifficulty:SetPoint("TOPRIGHT", caelLib.scale(-5), 0)
	MiniMapInstanceDifficulty:SetScale(0.75)

	GuildInstanceDifficulty:ClearAllPoints()
	GuildInstanceDifficulty:SetParent(Minimap)
	GuildInstanceDifficulty:SetPoint("TOPRIGHT", caelLib.scale(-5), 0)
	GuildInstanceDifficulty:SetScale(0.75)

	DurabilityFrame:UnregisterAllEvents()
	MiniMapMailFrame:UnregisterAllEvents()
	self:UnregisterEvent("PLAYER_ENTERING_WORLD")
end)